package cn.mothin.frame.util;

import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Component;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

@Component("51cf14ffbe31543d4ea89ec2")
public class JsonUtil {
	private Gson gson = new GsonBuilder().setDateFormat("MM/dd/yyyy HH:mm:ss").create();

	@SuppressWarnings("unchecked")
	public Map<String, Object> fromJson(String s) {
		return gson.fromJson(s, HashMap.class);
	}

	public <T> T fromJson(String s, Class<T> c) {
		return gson.fromJson(s, c);
	}

	public String toJson(Object o) {
		return gson.toJson(o);
	}
}
